<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:sd="http://schemas.silverdiagram.net/sd/2010/xaml"
    xmlns:localShapes="clr-namespace:SD.Shapes.Samples.CustomConnection">
    
    <Style TargetType="localShapes:MyConnection">
        <Setter Property="SourceDecorator" Value="Rhombus" />
        <Setter Property="SinkDecorator" Value="Arrow" />
        <Setter Property="BorderBrush" Value="Black" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="localShapes:MyConnection">
                    <Canvas>
                        <Path x:Name="Path" 
                            Stroke="{TemplateBinding BorderBrush}" 
                            StrokeThickness="{TemplateBinding Thickness}" 
                            StrokeDashArray="{TemplateBinding DashArray}" 
                            StrokeStartLineCap="Round" StrokeEndLineCap="Round" />

                        <Path x:Name="CollisionPath" Stroke="Transparent" />
                        
                        <sd:ConnectionLabel Position="Center" Index="0">
                            <TextBlock Text="Double Click Me!" />
                        </sd:ConnectionLabel>

                        <sd:ConnectionLabel Position="Source" Index="1">
                            <TextBlock Text="{TemplateBinding SourceMultiplicity}" />
                        </sd:ConnectionLabel>

                        <sd:ConnectionLabel Position="Source" Index="-1">
                            <TextBlock Text="{TemplateBinding SourceText}" />
                        </sd:ConnectionLabel>

                        <sd:ConnectionLabel Position="Sink" Index="1">
                            <TextBlock Text="{TemplateBinding SinkMultiplicity}" />
                        </sd:ConnectionLabel>

                        <sd:ConnectionLabel Position="Sink" Index="-1">
                            <TextBlock Text="{TemplateBinding SinkText}" />
                        </sd:ConnectionLabel>

                        <ContentPresenter Content="{TemplateBinding Source}" />
                        <ContentPresenter Content="{TemplateBinding Sink}" />

                        <sd:LineEndDecorator x:Name="SourceDecorator" RenderTransformOrigin="0, 0.5"  
                            Background="{TemplateBinding BorderBrush}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            Style="{TemplateBinding SourceDecoratorStyle}" />

                        <sd:LineEndDecorator x:Name="SinkDecorator" RenderTransformOrigin="0, 0.5"  
                            Background="{TemplateBinding BorderBrush}"
                            BorderBrush="{TemplateBinding BorderBrush}" 
                            Style="{TemplateBinding SinkDecoratorStyle}" />
                    </Canvas>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
